import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false
import 'element-ui/lib/theme-chalk/index.css';
import element from '@/utlis/element';
import './assets/element-variables.scss'
Vue.use(element)
import echarts from 'echarts';
Vue.prototype.$echarts = echarts

import VueQuillEditor from 'vue-quill-editor'
// require styles
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
router.beforeEach((to, from, next) => {
  let admin = sessionStorage.getItem('user')
  if (to.path == '/login') {
    if (admin) {
      next('/dashboard')
    }
  } else {
    if (!admin) {
      next('/login')
    }
  }
  next()
})
Vue.use(VueQuillEditor)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
